﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LanguageSource
{
    public delegate void ChangeLanguageDelegate(string language);
    public delegate string LoadLanguageDelegate(string key);
    public class ChangeService
    {
        public event LoadLanguageDelegate? OnLoadLanguage;
        public event ChangeLanguageDelegate? OnChangeLanguage;
        //发布切换语言
        public void ChangeLanguagePublish(string language)
        {
            OnChangeLanguage?.Invoke(language);
        }

        public string? GetValueByKey(string key)
        {
           return OnLoadLanguage?.Invoke(key);
        }
    }

    public class ChangeLanguage
    {
        public static ChangeService ChangeLanguageService { get; set; } = new ChangeService();
    }


}
